home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / ClassBobbing.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  1.6 KB  |  33 lines

  1. public class ClassBobbing extends Codex {
  2.    private CodexThing _tracker = new CodexThing(((Codex)this).GetClassThing());
  3.    private CodexThing _bobber;
  4.    private float _minSpeed;
  5.    private float _maxSpeed;
  6.    private float _delay;
  7.    public static String[] _params = new String[]{"Bobbing thing", "Min speed;8", "Max speed;15", "Delay;1"};
  8.  
  9.    public void beginscene(int clientGuid, int captureID) {
  10.       float[] offset = new float[3];
  11.       offset[0] = 0.0F;
  12.       offset[1] = 0.0F;
  13.       offset[2] = 0.0F;
  14.       this._tracker.AttachThing(this._bobber.GetGUID(), -1, offset, 0);
  15.       this._tracker.MoveToFrame(1, (float)((double)this._minSpeed + Math.random() * (double)(this._maxSpeed - this._minSpeed)));
  16.    }
  17.  
  18.    public void arrived(int thingGuid, int frameNum, int captureID) {
  19.       ((Codex)this).SetTimer(frameNum == 0 ? (float)(Math.random() * (double)this._delay) : 0.0F, 0, (float)(frameNum == 0 ? 1 : 0));
  20.    }
  21.  
  22.    public void timer(int timerID, float arg0, float arg1, float arg2, float arg3) {
  23.       this._tracker.MoveToFrame((int)arg0, (float)((double)this._minSpeed + Math.random() * (double)(this._maxSpeed - this._minSpeed)));
  24.    }
  25.  
  26.    public ClassBobbing(CodexThing bobber, float minSpeed, float maxSpeed, float delay) {
  27.       this._bobber = new CodexThing(((Codex)bobber).GetGUID());
  28.       this._minSpeed = minSpeed;
  29.       this._maxSpeed = maxSpeed;
  30.       this._delay = delay;
  31.    }
  32. }
  33.